# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=w32pth

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.0.5
pkgrel=2
pkgdesc="An emulation of PTH for MS Windows (mingw-w64)"
arch=('any')
license=("LGPL")
groups=("${MINGW_PACKAGE_PREFIX}")
url="http://www.gnupg.org"
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
options=('strip' 'staticlibs')
source=("ftp://ftp.g10code.com/g10code/w32pth/w32pth-${pkgver}.tar.bz2"
    w32pth-2.0.4-deffile.patch
    w32pth-2.0.4-mingw.patch)
sha1sums=('d648b98ce215f81e901f3f982470d37c704433a6'
          '8e64fa8432e990a4b0e5bedb62cebad64a8d7197'
          '27ac166bfe7761e56e6d6333b8af7b08c11fe5db')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/w32pth-2.0.4-deffile.patch
  patch -p1 -i ${srcdir}/w32pth-2.0.4-mingw.patch

  ./autogen.sh
}

build() {
  export lt_cv_deplibs_check_method='pass_all'
  mkdir -p ${srcdir}/build-${CARCH} && cd ${srcdir}/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --enable-shared \
    --disable-static
  make
}

package() {
  cd ${srcdir}/build-${CARCH}
  make -j1 DESTDIR="${pkgdir}" install
  rm ${pkgdir}${MINGW_PREFIX}/lib/*.def
}
